/*
 * Copyright (c) [2005] [Jeffrey Moore]
 *
 * Redistributions in source code form must reproduce the above copyright and 
 * this condition.
 *
 * The contents of this file are subject to the Sun Project JXTA License 
 * Version 1.1 (the "License"); you may not use this file except in compliance 
 * with the License. A copy of the License is available at 
 * http://www.jxta.org/jxta_license.html.
 *
 */

/*
 * ViJxtaDialog.java
 *
 * Created on April 9, 2005, 12:46 PM
 */

package net.jxta.myjxta.plugins.vijxta;

import net.jxta.logging.Logging;
import net.jxta.myjxta.MyJXTA;
import net.jxta.myjxta.View;
import net.jxta.myjxta.dialog.OneToOneCommandDialog;
import net.jxta.myjxta.plugin.PluginView;
import net.jxta.myjxta.util.Group;
import net.jxta.protocol.PipeAdvertisement;
import net.jxta.util.JxtaBiDiPipe;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Base dialog for ViJxta
 *
 * @author Jeff Moore
 */
public final class ViJxtaDialog extends OneToOneCommandDialog {


    public static final String IMFREE_DIALOG_NAME = IMFREE + "VIJXTADialog";
    public static final String DIALOG_NAME = IMFREE_DIALOG_NAME;


    private static final Logger LOG = Logger.getLogger(ViJxtaDialog.class.getName());
    private boolean m_locallyInitiated;


    public ViJxtaDialog(Group group, PipeAdvertisement pa, MyJXTA myJxta) {
        super(group, pa, myJxta);
        if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {
            LOG.info("new dialog for " + pa.getName());
        }

    }

    public PluginView getDialogPanel(View p_myJXTAView) {
        return new ViJxtaDialogView(p_myJXTAView, this, m_locallyInitiated);
    }

    public ViJxtaDialog(Group group, JxtaBiDiPipe pipe, MyJXTA myJxta) {
        super(group, pipe, myJxta);
        if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {
            LOG.info("new dialog for " + pipe.getPipeAdvertisement().getName());
        }
    }

    public void setLocallyInitiated(boolean p_b) {
        m_locallyInitiated = p_b;
    }

}
